Mark Sorel
2020-04-10
Most of the materials for this were taken from Uncovering ecological state dynamics with hidden Markov models (McClintock et al. 2020)
Slides were also taken from Sarah Converse and Beth Gardner’s UW SEFS 590 Advanced Population Analysis in Fish and Wildlife Ecology course materials
Zucchini et al. 2016. Hidden Markov Models for Time Series was also used.
An \(N\)-state hidden Markov model (HMM) can be specified by 3 components
An \(N\)-state hidden Markov model (HMM) can be specified by 3 components
An \(N\)-state hidden Markov model (HMM) can be specified by 3 components
Using matrix notation, the likelihood can be written as
\[L_{T}=\delta \mathbf{P}\left(x_{1}\right) \boldsymbol{\Gamma} \mathbf{P}\left(x_{2}\right) \boldsymbol{\Gamma} \mathbf{P}\left(x_{3}\right) \cdots \boldsymbol{\Gamma} \mathbf{P}\left(x_{T}\right) \mathbf{1}^{\prime}\]
What is the initial distribution?
What is the initial distribution?
What is the transition matrix?
What is the initial distribution?
What is the transition matrix?
What are the state dependant matrices?
What are the state dependant matrices?
“traditional” observation matrix
\(\mathbf{P}(x)\) with columns of “traditional” observation matrix along diagonals
Whats the probability of this capture history?
1010
Whats the probability of this capture history?
1010
\(\mathbf{\delta} = [1,0]\)
Whats the probability of this capture history?
1010
time 2 = \(\mathbf{\delta} \mathbf{\Gamma} \mathbf{P}\left(x_{1}\right)\)
\[\mathbf{\delta} \mathbf{\Gamma} = [1,0] \begin{bmatrix} \phi_1 & 1-\phi_1\\ 0 & 1 \end{bmatrix}= [\phi_1,~ 1-\phi_1]\]
Whats the probability of this capture history?
1010
time 2 = \(\mathbf{\delta} \mathbf{\Gamma} \mathbf{P}\left(x_{1}\right)\)
\[\mathbf{\delta} \mathbf{\Gamma} = [1,0] \begin{bmatrix} \phi_1 & 1-\phi_1\\ 0 & 1 \end{bmatrix}= [\phi_1,~ 1-\phi_1]\]
\[\mathbf{\delta} \mathbf{\Gamma} \mathbf{P}\left(x_{1}\right)=[\phi_1,~ 1-\phi_1] [1-p_1,~ 1]=[\phi_1(1-p_1),~(1-\phi_1)]\]
Whats the probability of this capture history?
1010
time 3 = \(\mathbf{\delta} \mathbf{\Gamma} \mathbf{P}\left(x_{1}\right) \mathbf{\Gamma} \mathbf{P}\left(x_{2}\right)\)
\[\mathbf{\delta} \mathbf{\Gamma} \mathbf{P}(x_{1}) \mathbf{\Gamma}=[\phi_1(1-p_1),~(1-\phi_1)]\begin{bmatrix} \phi_2 & 1-\phi_2\\ 0 & 1 \end{bmatrix}= \\ [\phi_1(1-p_1)\phi_2,~\phi_1(1-p_1)(1-\phi_2)+1-\phi_1] \]
Whats the probability of this capture history?
1010
time 3 = \(\mathbf{\delta} \mathbf{\Gamma} \mathbf{P}\left(x_{1}\right) \mathbf{\Gamma} \mathbf{P}\left(x_{2}\right)\)
\[\mathbf{\delta} \mathbf{\Gamma} \mathbf{P}(x_{1}) \mathbf{\Gamma}=[\phi_1(1-p_1),~(1-\phi_1)]\begin{bmatrix} \phi_2 & 1-\phi_2\\ 0 & 1 \end{bmatrix}= \\ [\phi_1(1-p_1)\phi_2,~\phi_1(1-p_1)(1-\phi_2)+1-\phi_1] \]
\[\mathbf{\delta} \mathbf{\Gamma} \mathbf{P}(x_{1}) \mathbf{\Gamma} \mathbf{P}(x_{2}) = [\phi_1(1-p_1)\phi_2,~\phi_1(1-p_1)(1-\phi_2)+1-\phi_1][p_2,~0]=[\phi_1(1-p_1)\phi_2p_2,~0]\]
Whats the probability of this capture history?
1010
time 4 = \(\mathbf{\delta} \mathbf{\Gamma} \mathbf{P}\left(x_{1}\right) \mathbf{\Gamma} \mathbf{P}\left(x_{2}\right)\mathbf{\Gamma} \mathbf{P}\left(x_{3}\right)\)
\[\mathbf{\delta} \mathbf{\Gamma} \mathbf{P}\left(x_{1}\right) \mathbf{\Gamma} \mathbf{P}\left(x_{2}\right)\mathbf{\Gamma}=[\phi_1(1-p_1)\phi_2 p_2,~0]\begin{bmatrix} \phi_3 & 1-\phi_3\\ 0 & 1 \end{bmatrix}= \\ [\phi_1(1-p_1)\phi_2p_2\phi_3,~\phi_1(1-p_1)\phi_2p_2(1-\phi_3)] \]
Whats the probability of this capture history?
010
time 4 = \(\mathbf{\delta} \mathbf{\Gamma} \mathbf{P}\left(x_{1}\right) \mathbf{\Gamma} \mathbf{P}\left(x_{2}\right)\mathbf{\Gamma} \mathbf{P}\left(x_{3}\right)\)
\[\mathbf{\delta} \mathbf{\Gamma} \mathbf{P}\left(x_{1}\right) \mathbf{\Gamma} \mathbf{P}\left(x_{2}\right)\mathbf{\Gamma}=[\phi_1(1-p_1)\phi_2 p_2,~0]\begin{bmatrix} \phi_3 & 1-\phi_3\\ 0 & 1 \end{bmatrix}= \\ [\phi_1(1-p_1)\phi_2p_2\phi_3,~\phi_1(1-p_1)\phi_2p_2(1-\phi_3)] \]
\[\mathbf{\delta} \mathbf{\Gamma} \mathbf{P}(x_{1}) \mathbf{\Gamma} \mathbf{P}(x_{2})\mathbf{\Gamma} \mathbf{P}(x_{3}) = [\phi_1(1-p_1)\phi_2p_2\phi_3,~\phi_1(1-p_1)\phi_2p_2(1-\phi_3)][1-p_3,1]=\\ [\phi_1(1-p_1)\phi_2p_2\phi_3(1-p_3),~\phi_1(1-p_1)\phi_2p_2(1-\phi_3)]\]
Whats the probability of this capture history?
1010
time 4 = \(\mathbf{\delta} \mathbf{\Gamma} \mathbf{P}\left(x_{1}\right) \mathbf{\Gamma} \mathbf{P}\left(x_{2}\right)\mathbf{\Gamma} \mathbf{P}\left(x_{3}\right)\)
\[\mathbf{\delta} \mathbf{\Gamma} \mathbf{P}\left(x_{1}\right) \mathbf{\Gamma} \mathbf{P}\left(x_{2}\right)\mathbf{\Gamma}=[\phi_1(1-p_1)\phi_2 p_2,~0]\begin{bmatrix} \phi_3 & 1-\phi_3\\ 0 & 1 \end{bmatrix}= \\ [\phi_1(1-p_1)\phi_2p_2\phi_3,~\phi_1(1-p_1)\phi_2p_2(1-\phi_3)] \]
\[\mathbf{\delta} \mathbf{\Gamma} \mathbf{P}(x_{1}) \mathbf{\Gamma} \mathbf{P}(x_{2})\mathbf{\Gamma} \mathbf{P}(x_{3}) = [\phi_1(1-p_1)\phi_2p_2\phi_3,~\phi_1(1-p_1)\phi_2p_2(1-\phi_3)][1-p_3,1]=\\ [\phi_1(1-p_1)\phi_2p_2\phi_3(1-p_3),~\phi_1(1-p_1)\phi_2p_2(1-\phi_3)]\]
\[\operatorname{Sum}(\mathbf{\delta} \mathbf{\Gamma} \mathbf{P}(x_{1}) \mathbf{\Gamma} \mathbf{P}(x_{2})\mathbf{\Gamma} \mathbf{P}(x_{3})) =\phi_1(1-p_1)\phi_2p_2\phi_3(1-p_3)+\phi_1(1-p_1)\phi_2p_2(1-\phi_3)\\ = \phi_1(1-p_1)\phi_2p_2\left[\phi_3(1-p_3)+(1-\phi_3)\right]\]
These can be fit in maximum likelihood (fast)
Lots of packages that already fit MRR models in ML
But ability to code your own enables use in integrated population models and other data integration applications
Can speed up some Bayesian analysis